<?php 
if($user !=null){
	foreach($user as $term){
		$key = 'flksjdfkjsldkfljslww3ruwe22AFSAGS';
		$string = $term["ID"];
		$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
		
		$cookie = array(
					'name'   => 'ID',
					'value'  => $encrypted,
					'expire' => '99999999999'
				);
		$this->input->set_cookie($cookie);
		$cookie = array(
					'name'   => 'display_name',
					'value'  => $term["display_name"],
					'expire' => '99999999999'
				);
		$this->input->set_cookie($cookie);
		$url = $this->input->cookie('url', TRUE);
		$this->load->helper('cookie');
		delete_cookie("url");
		if($url =="" or $url == null){
			header('Location: http://dict.'.DomainChinh);
		}else{
			header('Location: '.$url);
		}
	}
}else{// bat nguoi dung phai dang ki
	header('Location: http://test.'.DomainChinh.'/a/sig.php');
}


?>